package com.example.ponycui_home.svgaplayer;

import com.opensource.svgaplayer.SVGACache;
import com.opensource.svgaplayer.utils.PixelUtil;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * 单元测试
 */
public class LibraryOhosTest {
    private Context context;
    private SVGACache svgaCache;

    /**
     * 前置初始化
     */
    @Before
    public void setUp() {
        context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        PixelUtil.initContext(context);
        svgaCache = SVGACache.getInstance();
    }

    /**
     * 测试PixelUtil.screenWidth()
     */
    @Test
    public void testPixelUtilScreenWidth() {
        int i = PixelUtil.screenWidth();
        Assert.assertNotNull(i);
    }

    /**
     * 测试PixelUtil.screenHeight()
     */
    @Test
    public void testPixelUtilScreenHeight() {
        int i = PixelUtil.screenHeight();
        Assert.assertNotNull(i);
    }

    /**
     * 测试SVGACache.getInstance()
     */
    @Test
    public void testSVGACacheGetInstance() {
        Assert.assertNotNull(svgaCache);
    }

    /**
     * 测试SVGACache.OnCreate()
     */
    @Test
    public void testSVGACacheOnCreate() {
        svgaCache.onCreate(context);
        boolean is = svgaCache.isInitialized();
        Assert.assertNotNull(is);
    }

}